/*
 * Copyright (c) Zhongkehonglue Technologies Co., Ltd. 2025. All rights reserved.
 * Description: Implementation of functions related to the DMC module.
 * Author: wangchunyang
 * Create: 2025-05-23
 */

#ifndef DMC_API_TYPES_H
#define DMC_API_TYPES_H

#include <string>
#include <cstdint>
#include <functional>

namespace DlnaDmc {

using dmc_int32 = std::int32_t;
using dmc_uint32 = std::uint32_t;
using dmc_int64 = std::int64_t;

enum ErrCode {
    DMC_SUCCESS = 0,
    DMC_FAILURE = 1,
    DMC_INVALID_PARAMETER = 1000,
    DMC_ALLOC_MEM_FAILURE,
    DMC_NOT_INITED,
    DMC_ALREADY_INITED,
    DMC_CALLBACK_EMPTY,
    DMC_UNKNOWN_REASON
};

enum DmcDeviceType
{
    DMC_DEVICE_TYPE_DMS,
    DMC_DEVICE_TYPE_DMR,
};

struct UploadDeviceInfo {
    dmc_uint32 deviceId;
    std::string friendlyName;
    DmcDeviceType deviceType;
    std::string baseURL;
    std::string udn;
    std::string manufacturer;
    std::string modelName;
};

enum DmcChannelType {
    DMC_CHANNEL_TYPE_INVALID = -1,
    DMC_CHANNEL_TYPE_B = 0,
    DMC_CHANNEL_TYPE_CF = 1,
    DMC_CHANNEL_TYPE_LF = 2,
    DMC_CHANNEL_TYPE_LFC = 3,
    DMC_CHANNEL_TYPE_LFE = 4,
    DMC_CHANNEL_TYPE_LS = 5,
    DMC_CHANNEL_TYPE_MASTER = 6,
    DMC_CHANNEL_TYPE_RF = 7,
    DMC_CHANNEL_TYPE_RFC = 8,
    DMC_CHANNEL_TYPE_RS = 9,
    DMC_CHANNEL_TYPE_SD = 10,
    DMC_CHANNEL_TYPE_SL = 11,
    DMC_CHANNEL_TYPE_SR = 12,
    DMC_CHANNEL_TYPE_T = 13
};

enum DmcSeekMode
{
    DMC_SEEK_MODE_TRACK_NR,
    DMC_SEEK_MODE_ABS_TIME,
    DMC_SEEK_MODE_REL_TIME,
    DMC_SEEK_MODE_ABS_COUNT,
    DMC_SEEK_MODE_REL_COUNT,
    DMC_SEEK_MODE_CHANNEL_FREQ,
    DMC_SEEK_MODE_TAPE_INDX,
    DMC_SEEK_MODE_REL_TAPE_INDX,
    DMC_SEEK_MODE_FRAME,
    DMC_SEEK_MODE_REL_FRAME,
    DMC_SEEK_MODE_END
};

struct DmrTrackPosition
{
    dmc_uint32 currentTrack;
    std::string trackDur;
    std::string trackMetaData;
    std::string trackUri;
    std::string relTime;
    std::string absTime;
    dmc_int32 relCount;
    dmc_int32 absCount;
};

enum DmcTransportState {
    DMC_TRANSPORT_STOPPED = 0,
    DMC_TRANSPORT_PLAYING = 1,
    DMC_TRANSPORT_PAUSED_PLAYBACK = 2,
    DMC_TRANSPORT_PAUSED_RECODING = 3,
    DMC_TRANSPORT_NO_MEDIA_PRESENT = 4,
    DMC_TRANSPORT_TRANSITIONING = 5,
};

enum DmcTransportStatus {
    DMC_TRANSPORT_OK = 0,
    DMC_TRANSPORT_ERROR = 1,
};

struct DmcCbType {
    std::function<dmc_int32(const UploadDeviceInfo &uploadInfo)> deviceUpCb;
    std::function<dmc_int32(dmc_uint32 deviceId)> deviceDownCb;
};
}
#endif /* DMC_API_TYPES_H */